package com.nervenets.web.hibernate.dao;

import com.nervenets.web.hibernate.domain.knowledge.Knowledge;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface KnowledgeDao extends JpaRepository<Knowledge, Long>, JpaSpecificationExecutor<Knowledge> {
    @Query(value = "select count(*) from tags_of_knowledge where tags_id = :tagsId", nativeQuery = true)
    long countByTagsId(@Param("tagsId") long tagsId);
}
